﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Mads.CoreDomain
{
  /// <summary>
  /// Represent seat in one race.
  /// </summary>
  [DataContract]
  public class Seat : KeyAbstraction
  {
    /// <summary>
    /// Number of the seat in a car.
    /// </summary>
    [DataMember]
    public uint Number { get; private set; }

    /// <summary>
    /// Car that this seat belongs to.
    /// </summary>
    [DataMember]
    public Car Car { get; private set; }

    /// <summary>
    /// Race that this seat belongs to.
    /// </summary>
    [DataMember]
    public Race Race { get; private set; }

    /// <summary>
    /// Tickets for this seat.
    /// </summary>
    public IEnumerable<Ticket> Tickets { get; private set; }

    public Seat(uint number, Car car, Race race)
    {
      if (car == null)
      {
        throw new ArgumentNullException("car");
      }
      if (race == null)
      {
        throw new ArgumentNullException("race");
      }

      Number = number;
      Car = car;
      Race = race;
    }
    public Seat(uint id)
      : base(id)
    {
    }
  }
}